/**
 * 
 */
package fr.ssd.sdl.parser;

public class Parameter{
	
	public int idxBegin = -1;
	public int idxEnd = -1;
	public String table;
	public String column;
	public String localKey;
	public String resolvedKey;
	
	
	public String getAttName() {
		return "${"+table+"."+column+"."+localKey+"}";
	}
	
	public boolean equals(Object o){
		if(o instanceof Parameter){
			Parameter p = (Parameter)o;
			return this.table.equalsIgnoreCase(p.table) &&
				   this.column.equalsIgnoreCase(p.column) &&
				   this.localKey.equalsIgnoreCase(p.localKey);
		}
		return false;
	}
	
	@Override
	public int hashCode() {
		return getAttName().hashCode();
	}

	public String toString(){
		return getAttName() + " ("+resolvedKey+")";
	}
}